package com.yanu.trace.t2s.controller;

import com.yanu.trace.t2s.entity.Dept;
import com.yanu.trace.t2s.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//http://127.0.0.1:8080/dept/get/10

//22222222222222222222
@CrossOrigin
@RestController
@RequestMapping("/dept")
public class DeptController {

    @Autowired
    DeptService deptService;


    @GetMapping("get/{deptno}")
    public Dept fn1(@PathVariable int deptno){

        return  deptService.findByDeptno(deptno);
    }

    @GetMapping("get")
    public List<Dept> fd2(){

        return  deptService.findAll();
    }
    @GetMapping("get1")
    public List<Dept> fd3( Dept dept ){
        System.out.println("DeptController.fd3");
        System.out.println(dept);
        return null;// deptService.findAll();
    }
}
